<template>
	<view>
		<!-- 纠错弹窗 -->
		<u-popup :show="showJiucuo" mode="bottom" @close="closeErrorBtn" >
			<view class="jiucuoInfo">
				<text class="jiucuo-title">选择类型</text>
				<view class="jiucuo-menu">
					<view v-for="(item,index) in jiucuoKeywords" :key="index" @click="changeColor(index)"
						:class="{active: initerrorType === index}">
						{{ item }}
					</view>
				</view>
		
				<view class="import-content">
					<text style="color: #3B3E45;font-size: 28rpx;font-weight: bold;">具体内容 <text
							style="color: #ADB4C2;font-size: 24rpx;">（必填项）</text> </text>
					<textarea placeholder="请您具体描述，方便我们的工作人员为您具体和事。" v-model="inputInfo"
						placeholder-style="color:#ADB4C2;font-size:24rpx"
						style=""></textarea>
				</view>
				<view class="footerBtn">
					<view class="cancelBtn" @click="closeErrorBtn">
						取消
					</view>
		
					<view class="quedingBtn">
						<u-button text="确定" @click="submitError"></u-button>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		name: "side-kefu",
		props:['ids','type','showJiucuo'],
		data() {
			return {
				//纠错相关
				jiucuoKeywords: ['信息日期过期', '地区错误', '信息重复', '附件未传', '未上表格', '信息不全面', '附件下载打不开', '内容与标题不符', '信息无内容',
					'附件上传错误',
					'格式错误', '信息类型错误'
				],
				initerrorType: 0,
				inputInfo: "",
			};
		},
		created() {
		
		},
		watch:{
			
		},
		computed: {
			
		},
		methods: {
			//报错
			changeColor(index) {
				this.initerrorType = index
			},
			//提交纠错信息
			submitError(){
				
				if (uni.$u.test.isEmpty(this.inputInfo)) {
					uni.$u.toast('请输入反馈的具体内容！');
					return;
				}
				//目前提交不成功是因为token，登陆完就可以用了
				uni.$u.http
					.post('/zhaobiao/JiucuoHandler.ashx', {
						location: 5106,
						xuqiu: this.inputInfo, // 问题描述	string	Y	-
						errortp: this.initerrorType, // 错误类型	string	Y	-
						nid: this.ids, // 信息id
						ntp: this.type
					})
					.then(rs => {
						uni.$u.toast('提交成功！');
						this.closeErrorBtn();
					})
					.catch(err => {
						uni.$u.toast(err.msg || '提交信息反馈接口异常');
					});
			},
			//关闭纠错弹窗
			closeErrorBtn() {
				this.$emit('update:showJiucuo',false)
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.jiucuoInfo {
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		background-color: #fff;
		padding: 40rpx 0 0 0;
		
		.active {
			color: #0643ff !important;
			background: rgba(47, 109, 254, 0.06) !important;
		}
	
		.jiucuo-title {
			font-size: 28rpx;
			color: #3B3E45;
			font-weight: bold;
			margin-left: 30rpx;
		}
	
		.jiucuo-menu {
			margin-left: 30rpx;
			display: flex;
			flex-wrap: wrap;
			view {
				width: 220rpx;
				height: 58rpx;
				line-height: 58rpx;
				background-color: #f6f8fa;
				text-align: center;
				margin-right: 20rpx;
				margin-top: 20rpx;
				color: #3B3E45;
				font-size: 24rpx;
			}
		}
	
		.import-content {
			margin-left: 30rpx;
			margin-top: 37rpx;
	
			textarea {
				padding: 40rpx  24rpx ; 
				font-size: 28rpx;
				height: 200rpx;
			}
		}
	
		.footerBtn {
			display: flex;
			justify-content: space-between;
			border-top: 1px solid #eeeeee;
			padding: 20rpx 28rpx;
	
			.cancelBtn {
				padding: 0 20rpx;
				height: 98rpx;
				line-height: 98rpx;
				color: #6c717e;
				font-size: 32rpx;
			}
	
			.quedingBtn {
				width: 562rpx;
	
				::v-deep.u-button--info {
					color: #323233;
					border-color: #ebedf0;
					border-width: 1px;
					border-style: solid;
					background: linear-gradient(90deg, #1f91ff 0%, #1d11fb 100%);
					border-radius: 10rpx;
					height: 98rpx;
	
					text {
						color: #fff;
						font-size: 32rpx;
					}
				}
			}
		}
	}
</style>